package edu.pitt.dbmi.odie.gapp.gwt.client.filter;

import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.DataSourceField;
import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.FieldType;

public class ODIE_CountryDS extends DataSource {

	// The DataSource would normally be defined external to any classes that use
	// it.

	private static ODIE_CountryDS instance = null;

	public static ODIE_CountryDS getInstance() {
		if (instance == null) {
			instance = new ODIE_CountryDS("countryDS_XML");
		}
		return instance;
	}

	public ODIE_CountryDS(String id) {
		setID(id);
		setDataFormat(DSDataFormat.XML);
		setRecordXPath("/List/country");
		DataSourceField countryCodeField = new DataSourceField("countryCode",
				FieldType.TEXT, "Code");
		DataSourceField countryNameField = new DataSourceField("countryName",
				FieldType.TEXT, "Country");
		DataSourceField capitalField = new DataSourceField("capital",
				FieldType.TEXT, "Capital");
		setFields(countryCodeField, countryNameField, capitalField);
		setDataURL("data/dataIntegration/xml/country.data.xml");
	}

}